﻿@using mock_ehr_web.Models
@model mock_ehr_lib.Model.Summary.PatientSummary
<script language="javascript" type="text/javascript">
    $(function () {
        $('#loading').hide()  // hide it initially
                     .ajaxStart(function () {
                         $(this).show();
                     })
                     .ajaxStop(function () {
                         $(this).hide();
                     });
        $("#tabs").tabs({
            load: function (event, ui) {
                $("#immunizations .infobutton").click(function () {
                    var frame = $("<iframe>");
                    var anchor = $(this);
                    frame.attr("src", anchor.attr("data-infobutton-url"));
                    frame.ready(function () {
                        $("#immunizations .tool").html(frame);
                    });
                });

                $("#quality .infobutton").click(function () {
                    var anchor = $(this);
                    window.open(anchor.attr("data-infobutton-url"), '_newtab');
                });

                $("#order-tabs").tabs(
                {
                    load: function (event, ui) {
                        $("#nursing .infobutton, #radiology .infobutton").click(function () {
                            var anchor = $(this);
                            window.open(anchor.attr("data-infobutton-url"), '_newtab');
                        });
                    }
                }
                );
            },
            cache: false
        });
        $.address.change(function (event) {
            $("#tabs").tabs("select", window.location.hash)
        });
        $("#tabs").bind("tabsselect", function (event, ui) {
            window.location.hash = ui.tab.hash;
        });

        $("#DOB").datepicker();
    });
</script>
<div id="general">
    @Model.FamilyName, @Model.GivenName
</div>
<div id="tabs">
    <ul>
        <li><a href="#overview">Overview</a></li>
        <li>@Html.ActionLink("History", "History", "Patient", new { Model.ID }, new { title = "history" })<span>&nbsp;</span></li>
        <li>@Html.ActionLink("Problems", "Problems", "Patient", new { Model.ID }, new { title = "problems" })<span>&nbsp;</span></li>
        <li>@Html.ActionLink("Alerts & Allergies", "Alerts", "Patient", new { Model.ID }, new { title = "alerts" })<span>&nbsp;</span></li>
        <li>@Html.ActionLink("Immunizations", "Immunizations", "Patient", new { Model.ID }, new { title = "immunizations" })<span>&nbsp;</span></li>
        <li>@Html.ActionLink("Order Entry", "Index", "Order", new { }, new { title = "order-entry" })<span>&nbsp;</span></li>
        <li>@Html.ActionLink("Quality", "Quality", "Patient", new { Model.ID }, new { title = "quality" })<span>&nbsp;</span></li>
    </ul>
    <div id="overview">
        <fieldset>
            @Html.LabelFor(i => Model.GivenName, "First Name")
            @Html.TextBoxFor(i => Model.GivenName)
            @Html.LabelFor(i => Model.FamilyName, "Last Name")
            @Html.TextBoxFor(i => Model.FamilyName)
            @Html.LabelFor(i => Model.DOB, "DOB")
            @Html.TextBoxFor(i => Model.DOB)
        </fieldset>
    </div>
    
</div>

